<template>
  <div class="modify">
    <van-nav-bar
        title="收货地址"
        left-text="返回"
        left-arrow
        @click-left="$router.go(-1)"
        />
    <!-- 修改收货地址 -->
    <div class="content">
            <div class="t">
            联系人：<input type="text" v-model="modlist.name">
            </div>
            <div class="c">
            电话：<input type="text" v-model="modlist.phone">
            </div>
            <div class="b">
            地址：<input type="text" v-model="modlist.address">
            </div>
            <div class="btn">
                <button @click="request_address_delete(delist)">删除</button>
                <!-- <button >删除</button> -->
                <button @click="request_address_edit(modlist)">确定</button>
            </div>
        </div>
  </div>
</template>

<script>
import {address_edit,address_del,address_list} from '../utils/api'
import { mapState,mapMutations,mapGetters,mapActions } from 'vuex'
export default {
    data(){
        return {
            delist:{
                addressid:JSON.parse(this.$route.query.list).addressid,
                userid:JSON.parse(this.$route.query.list).userid,
            },
            // input:{
            //     userid:'',
            //     address:'',
            //     phone:'',
            //     name:'',
            // },
            // userid:'',
            // addressid:'',
            // address:'',
            // phone:'',
            // name:'',
            // list:{userid,},
            // list:{userid,addressid,address,phone,name},
            modlist:{}
        }
    },
    mounted(){
        // var id = this.$route.params.id;
        // this.userid = this.$route.query.userid;
        // console.log(this.userid);
        // this.addressid = this.$route.query.addressid;
        // console.log(this.addressid);
        // this.address = this.$route.query.address;
        // console.log(this.address);
        // this.phone = this.$route.query.phone;
        // console.log(this.phone);
        // this.name = this.$route.query.name;
        // console.log(this.name);
        this.modlist=JSON.parse(this.$route.query.list)
        console.log(this.modlist);
        // var item = this.$route.params.item;
        // console.log(item);
        // address_list({userid:id}).then((res)=>{
        //     this.list = res.data.list;
        //     console.log(this.list);
        // })

        address_del({}).then((res)=>{
        if(res.data.code == 200){
          console.log(res.data);
        }
       })
    },
    computed:{
        ...mapState(['addresslist'])
    },
    methods:{
        ...mapActions(['request_address_delete','request_address_edit']),
        // handelclick(){
        //     this.input.userid = JSON.parse(localStorage.getItem('userinfo')).id;
            
        // }
    },
}
</script>

<style lang="scss" scoped>
.content{
    width: 100%;
    height: 80px;
    .t{
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 60px;
        line-height: 60px;
        // background-color:blanchedalmond ;
        input{
            padding: 0 20px;
            height: 30px;
            border: 0;
        }
    }
    .c{
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 60px;
        line-height: 60px;
        // background-color:blanchedalmond ;
        input{
            padding: 0 20px;
            height: 30px;
            border: 0;
        }
    }
    .b{
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 60px;
        line-height: 60px;
        // background-color:blanchedalmond ;
        input{
            padding: 0 20px;
            height: 30px;
            border: 0;
        }
    }
    .btn{
        // display: block;
        width: 100%;
        height: 50px;
        display: flex;
        color: white;
        button:nth-child(1){
            border:0;
            background-color: lightpink;
            display: block;
            margin: 0 auto;
            width: 50%;
            height: 50px;
            margin: 10px 10px;
        }
        button:nth-child(2){
            border:0;
            background-color: lightseagreen;
            display: block;
            margin: 0 auto;
            width: 50%;
            height: 50px;
            margin: 10px 10px;
        }
    }
}
</style>